package com.gao.frame.study.shop.user.nacos;

import com.alibaba.nacos.api.annotation.NacosProperties;
import com.alibaba.nacos.api.config.annotation.NacosValue;
import com.alibaba.nacos.spring.context.annotation.config.EnableNacosConfig;
import com.alibaba.nacos.spring.context.annotation.config.NacosPropertySource;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p></p>
 *
 * @author GaoShuangWen
 * @since 2019-09-25 14:51
 */
@Configuration
@EnableNacosConfig(globalProperties = @NacosProperties(serverAddr = "49.235.85.213:8848"))
@NacosPropertySource(dataId = "123", autoRefreshed = true)
public class NacosCofiguration {
    @RestController
    class TestNacosController {
        @NacosValue(value = "${a:cuo}", autoRefreshed = true)
        private String useLocalCache;

        @GetMapping(value = "/get")
        public String get() {
            return this.useLocalCache;
        }
    }
}
